import { Button } from 'antd-mobile';
import React, { useState,useMemo}from  'react'
import style from '../Css/cart.module.css'
import dayjs from 'dayjs';
function Mydate(props) {
  const [sp,setsp]=useState([])
  setsp=useMemo(()=>props.date,[sp])
    const shijian=()=>{
        const typt=dayjs(props.data).add(setsp,'day').format('MM月DD日')
        setsp(typt)
    }

  return (
    <div className={style.pp}>
        <Button size='small' color='primary' onClick={()=>shijian(-1)}>
            上一天
          </Button>
          <span>{props.date}</span>
          <Button size='small' color='primary' onClick={()=>shijian(1)}>
            下一天
          </Button>
    </div>
  )
}

export default Mydate
